import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { knowledge } from '../apiModulesType';

// 获取资源列表
export function getResourceList(query: any): AxiosPromise<any> {
  return request({
    url: `${knowledge}/api/sysResource`,
    method: 'get',
    params: query
  });
}

// 新增资源
export function addResource(data: any): AxiosPromise<any> {
  return request({
    url: `${knowledge}/api/sysResource`,
    method: 'post',
    data: data
  });
}

// 删除资源
export function deleteResource(ids: any): AxiosPromise<any> {
  return request({
    url: `${knowledge}/api/sysResource`,
    method: 'delete',
    data: ids
  });
}

// 修改资源
export function updateResource(data: any): AxiosPromise<any> {
  return request({
    url: `${knowledge}/api/sysResource`,
    method: 'put',
    data: data
  });
}

// 获取资源类型
export function getResourceTypeList(query: any): AxiosPromise<any> {
  return request({
    url: `${knowledge}/api/sysResourceType/get-all`,
    method: 'get',
    params: query
  });
}

// 新增资源类型
export function addResourceType(data: any): AxiosPromise<any> {
  return request({
    url: `${knowledge}/api/sysResourceType/add`,
    method: 'post',
    data: data
  });
}

// 删除资源类型
export function deleteResourceType(id: number): AxiosPromise<any> {
  return request({
    url: `${knowledge}/api/sysResourceType/delete/${id}`,
    method: 'delete'
  });
}
// 修改资源类型
export function updateResourceType(data: any): AxiosPromise<any> {
  return request({
    url: `${knowledge}/api/sysResourceType/edit`,
    method: 'put',
    data: data
  });
}

// 获取日程列表
export function getCalendarList(query: any): AxiosPromise<any> {
  return request({
    url: `${knowledge}/api/sysCalendarType/get-all-sys-calendar-types`,
    method: 'get',
    params: query
  });
}
// 新增日程
export function addCalendar(data: any): AxiosPromise<any> {
  return request({
    url: `${knowledge}/api/sysCalendarType/sys-calendar-type/create`,
    method: 'post',
    data: data
  });
}
// 删除日程
export function deleteCalendar(params: any): AxiosPromise<any> {
  return request({
		url: `${knowledge}/api/sysCalendarType/delete-sys-calendar-type`,
		method: 'delete',
		params
	})
}

// 修改日程
export function updateCalendar(data: any): AxiosPromise<any> {
  return request({
		url: `${knowledge}/api/sysCalendarType/update-sys-calendar-type`,
		method: 'put',
		data
	})
}

// 获取权限列表
export function apiSysSchedulePermissionsGetAll(query: any): AxiosPromise<any> {
  return request({
    url: `${knowledge}/api/sys/schedule/permissions/get-all`,
    method: 'get',
    params: query
  });
}
// 查询权限详细
export function apiSysSchedulePermissionsGetRelevance(params?: any): AxiosPromise<any> {
  return request({
    url: `${knowledge}/api/sys/schedule/permissions/get-relevance`,
    method: 'get',
    params
  });
}
//新增权限
export function apiSysSchedulePermissionsAdd(data: any): AxiosPromise<any> {
  return request({
    url: `${knowledge}/api/sys/schedule/permissions/add`,
    method: 'post',
    data
  });
}
// 修改权限数据回显
export function apiSysSchedulePermissionsEditId(id: any): AxiosPromise<any> {
  return request({
    url: `${knowledge}/api/sys/schedule/permissions/edit/${id}`,
    method: 'get'
  });
}
// 修改权限
export function apiSysSchedulePermissionsEdit(data: any): AxiosPromise<any> {
  return request({
    url: `${knowledge}/api/sys/schedule/permissions/edit`,
    method: 'put',
    data
  });
}
// 删除权限
export function apiSysSchedulePermissionsDelete(id: any): AxiosPromise<any> {
  return request({
    url: `${knowledge}/api/sys/schedule/permissions/delete/${id}`,
    method: 'delete'
  });
}
